package singleton.test;

import com.gupao.edu.study.singleton.LazyDoubleCheck;

import java.util.concurrent.CountDownLatch;

public class LazyTestDemo2 {
    public static void main(String[] args) {
        int count = 200;
        long starter = System.currentTimeMillis();
        CountDownLatch countDownLatch = new CountDownLatch(count);
        for (int i = 0; i < count; i++) {
            new Thread(() -> {
                LazyDoubleCheck lazy = LazyDoubleCheck.getInstance();
                System.out.println(System.currentTimeMillis() + ":" + lazy);
                countDownLatch.countDown();
            }).start();
        }
        try {
            countDownLatch.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        long end = System.currentTimeMillis();
        System.out.println("总计耗时" + (end - starter));
    }
}
